package cn.shenxingbang.chatroom.config;

import javax.websocket.HandshakeResponse;
import javax.websocket.server.HandshakeRequest;
import javax.websocket.server.ServerEndpointConfig;

public class MyServerEndpointConfigurator extends ServerEndpointConfig.Configurator {
    @Override
    public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {

        String realIP = request.getHeaders().get("x-real-ip").toString();
        sec.getUserProperties().put("realIP", realIP);
        super.modifyHandshake(sec, request, response);
    }
}
